import {ajaxFun} from "../../../utils/ajax"
Page({
  data: {
      obj:{}
  },

  onLoad(options) {
       console.log(options.id);// ajax请求
       this.getDesc(options.id)
  },
  async getDesc(id){
    let result=await ajaxFun(`/goods/detail/${id}`,"get");
    this.setData({
      obj:result.data
    })
  },
  gocart(){
    wx.switchTab({
      url: '/pages/cart/cart',
    })
  },
 async addCart(){
    let result=await ajaxFun("/shop-cart","post",{
      "goodsCount": 1,//商品数量
      "goodsId": this.data.obj.goodsId //商品id
    })
  }

})